/** \file
* Implementation of the default Twitter element database class.
* This file is part of Chorus, available at
* http://code.google.com/p/chorus-twitter/ . This file and all associated files
* and derivative works are bound by the terms of the LGPL 3.0 license,
* available at http://www.gnu.org/licenses/lgpl-3.0-standalone.html .
* \par Subversion URL:
* \$URL: http://chorus-twitter.googlecode.com/svn/branches/cpp/src/xml/DefaultTree.cpp $
* \version \$Rev: 153 $
* \date    \$Date: 2010-04-06 07:43:42 +0000 (Tue, 06 Apr 2010) $
*/

#include "config.h"

#include "system/DebugConsole.hpp"

#include "xml/XmlFileSource.hpp"
#include "xml/XmlUrlSource.hpp"

#include "xml/DefaultTree.hpp"

DefaultTree::DefaultTree(CurlGlob *curlGlobInit) :
	curlGlob(curlGlobInit)
{
}

bool DefaultTree::loadPerform()
{
	XmlFileSource filesource(this, getFilePath());
	if (!filesource.fetch())
		return false;

	PDEBUG2("Number of database elements after load: ", getNumElements());

	return updatePerform();
}

bool DefaultTree::updatePerform()
{
	XmlUrlSource urisource(this, getUrlPath(), curlGlob);
	return urisource.fetch();

	PDEBUG2("Number of database elements after update: ", getNumElements());

	return true;
}

bool DefaultTree::savePerform()
{
	return false;
}
